<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>

  <body>
    <!-- 
		slot插槽，可扩展
		1.插槽的基本使用：<slot></slot>
		2.插槽的默认值：<slot>默认标签</solt>
		3.如果组件实例内有多个值，会同时放入到cpn组件模板的slot中作为进行替换元素
	 -->

    <div id="app">
      <cpn></cpn>

      <cpn>
        <span>我是span</span>
      </cpn>

      <cpn>
        <h2>222</h2>
        <h2>222</h2>
      </cpn>

      <cpn></cpn>
      <cpn></cpn>
    </div>

    <template id="cpn">
      <div>
        <h2>我是组件</h2>
        <slot><button>按钮</button></slot>
      </div>
    </template>

    <script src="../js/vue.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          message: '你好'
        },
        components: {
          cpn: {
            template: '#cpn'
          }
        }
      })
    </script>
  </body>
</html>
